import request from '@/utils/request'

// 获取表单初始列表
export function getArchiveList(query) {
  return request({
    url: '/archive/archiveFormSave/getArchiveList',
    method: 'get',
    params: query
  })
}
// 移除归档申请单  删除接口，可以多选
export function delArchiveFormSave(formIds) {
  return request({
    url: '/archive/archiveFormSave/' + formIds,
    method: 'delete'
  })
}
// 提交申请单
export function submit(data) {
  return request({
    url: '/archive/archiveFormSave/submit',
    method: 'POST',
    data: data
  })
}

//获取人员树接口
export function deptUserTree(query) {
  return request({
    url: '/system/user/deptUserTreeNoDateScope',
    method: 'GET',
    params: query
  })
}

export function roleUserTree(query) {
  return request({
    url: '/system/user/roleUserTreeNoDateScope',
    method: 'GET',
    params: query
  })
}

// 获取流程类型
export function getProcessType() {
  return request({
    url: '/activiti/activitiApiController/getProcessKeyName',
    method: 'get'
  })
}

// 获取task对应流程审批信息
export function getProcessDate(id) {
  return request({
    url: '/activiti/activitiApiController/getProcessDate/'+ id,
    method: 'get'
  })
}


// 查询归档待办事项
export function taskList(query) {
  return request({
    url: '/activiti/workflowArchiveSave/taskList',
    method: 'get',
    params: query
  })
}

// 单个同意、不同意
export function formDataSave(data) {
  return request({
    url: '/activiti/task/formDataSave/'+ data.id,
    method: 'post',
    data: data
  })
}

// 批量同意/不同意
export function formDataSaveAll(data) {
  return request({
    url: '/activiti/task/formDataSaveAll/'+ data.id,
    method: 'post',
    data: data
  })
}

// 查询归档已办事项
export function taskHistoryList(query) {
  return request({
    url: '/activiti/workflowArchiveSave/taskHistoryList',
    method: 'get',
    params: query
  })
}

// 查询个人提交事项
export function taskListByStartUser(query,processKey) {
  return request({
    url: '/activiti/activitiApiController/taskListByStartUser/'+processKey,
    method: 'get',
    params: query
  })
}
// 查看档案数据
export function getArchiveInfo(data) {
  return request({
    url: '/archive/archiveFormSave/getArchiveInfo?level=' + data.level + '&menuId=' + data.menuId,
    method: 'post',
    data: data
  })
}

//获取表头
export function getthbytreenodeHeaderList(data) {
  return request({
    url: '/archive/wjzl/getthbytreenode',
    method: 'POST',
    data: data
  })
}

// 设置流程中单条状态是否同意
export function setArchiveProcessStatusByArchiveId(data) {
  return request({
    url: '/activiti/workflowArchiveSave/setArchiveProcessStatusByArchiveId/'+ data.processId + '/' + data.archiveId + '/' + data.status,
    method: 'put'
  })
}

// 四性检测方案不分页
export function getdetectionSchemeList(query) {
  return request({
    url: '/archive/detectionScheme/getList',
    method: 'GET',
    params: query
  })
}

// 归档包四性检测
export function detection(data) {
  return request({
    url: '/archive/detectionObject/daDetection',
    method: 'POST',
    data: data
  })
}

//获取详情
export function listinfo(query) {
  return request({
    url: '/archive/inspectionLogs/list',
    method: 'GET',
    params: query
  })
}

// 统计
export function getArchiveTotal(query) {
  return request({
    url: '/archive/archiveFormSave/getArchiveTotal',
    method: 'POST',
    params: query
  })
}

export function downloadDocx(query) {
  return request({
    url: '/archive/archiveFormSave/downloadArchiveTable',
    method: 'POST',
    data: query
  })
}

export function changeAllArchiveState(processId,status) {
  return request({
    url: '/activiti/workflowArchiveSave/changeAllArchiveState/'+ processId  + '/' + status,
    method: 'put'
  })
}

// 获取task对应流程审批信息
export function getProcessDateByProcessId(id) {
  return request({
    url: '/activiti/activitiApiController/getProcessDateByProcessId/'+ id,
    method: 'get'
  })
}
